#pragma once

#include <odb/database.hxx>
#include <odb/mysql/database.hxx>
#include <sstream>


namespace xu
{
    class MysqlClientFactory
    {
    public:
        static std::shared_ptr<odb::mysql::database> Create(const std::string & user,
            const std::string &pswd,const std::string &db_name,
            const std::string &host,const std::string &cset)
            {
                std::unique_ptr<odb::mysql::connection_pool_factory> cpf(
                new odb::mysql::connection_pool_factory(3, 0));
                //2. 构造数据库操作对象
                auto res = std::make_shared<odb::mysql::database>(
                user, pswd, db_name,host, 0, "", cset,1, std::move(cpf));

                return res;
            }
    };
}